package com.maolong.deadpro.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
@Slf4j
public class ReturnCallBack implements RabbitTemplate.ReturnsCallback {
    @Override
    public void returnedMessage(ReturnedMessage returned) {
        String message= Arrays.toString(returned.getMessage().getBody());
        log.info("消息发送失败，消息内容：{},失败id{}", message,returned.getMessage().getMessageProperties().getMessageId());
    }
}
